package model

import business.Attackable
import enums.Direction

/** 敌方坦克类型三
 *  超级坦克
 * */
class EnemyTank03(override var x:Int, override var y:Int) :EnemyTank(x,y){
    override var pool: Int=4
    var gradle=4

    init {
        minCooldownTime=500
        maxCooldownTime=1500
        moveCooldownTime=80
    }

    override fun draw() {
        var i = when(gradle) {
            4 -> 5
            3 -> 5
            2 -> 4
            else -> 3
        }
        imgPath=when(currentDirection){
            Direction.UP->"img/enemy_${i}_u.gif"
            Direction.DOWN->"img/enemy_${i}_d.gif"
            Direction.LEFT->"img/enemy_${i}_l.gif"
            Direction.RIGHT->"img/enemy_${i}_r.gif"
        }
        super.draw()
    }

    override fun notifySuffer(attack: Attackable): ArrayList<IView> {
        val list = super.notifySuffer(attack)
        when{
            pool==4 -> {
                minCooldownTime=500
                maxCooldownTime=1500
                moveCooldownTime=50
                gradle=4
            }pool==3 -> {
                minCooldownTime=500
                maxCooldownTime=1500
                moveCooldownTime=50
                gradle=3
            }
            pool==2 -> {
                minCooldownTime=1000
                maxCooldownTime=2000
                moveCooldownTime=80
                gradle=2
            }
            else->{
                minCooldownTime=2000
                maxCooldownTime=3000
                moveCooldownTime=100
                gradle=1
            }
        }

        /** 被打第一枪的时候调出强化物 */
        if(pool==3){
            list.add(Enhance())
        }

        return list
    }

    override fun shot(gradle: Int): Bullet? {
        var a=if(this.gradle>=3) 2 else 1
        return super.shot(a)
    }
}